package Arithmetic;

import junit.framework.TestCase;

/**
 * Created by jxy6996 on 2017/5/21.
 */
public class RationalNumberTest extends TestCase {
    public void testGetNumerator() throws Exception {
        RationalNumber r = new RationalNumber(1,3);
        assertEquals("1",r.getNumerator());
    }

    public void testGetDenominator() throws Exception {
        RationalNumber r = new RationalNumber(1,3);
        assertEquals("3",r.getDenominator());
    }

    public void testReciprocal() throws Exception {
        RationalNumber r = new RationalNumber(1,3);
        assertEquals("3",r.reciprocal());
    }

    public void testAdd() throws Exception {
        RationalNumber r1 = new RationalNumber(1,3);
        RationalNumber r2 = new RationalNumber(1,2);
        assertEquals("5/6",r1.add(r2));
    }

    public void testSubtract() throws Exception {
        RationalNumber r1 = new RationalNumber(1,3);
        RationalNumber r2 = new RationalNumber(1,2);
        assertEquals("-1/6",r1.subtract(r2));
    }

    public void testMultiply() throws Exception {
        RationalNumber r1 = new RationalNumber(1,3);
        RationalNumber r2 = new RationalNumber(1,2);
        assertEquals("1/6",r1.multiply(r2));
    }

    public void testDivide() throws Exception {

    }

    public void testIsLike() throws Exception {
    }

    public void testToString() throws Exception {
    }

}